<?php
    $aPosition = unserialize(ADVERTISE_POST_ARRAY);
    $sOptionPosition = "";
    foreach($aPosition as $key=>$ps) {
        $sOptionPosition .= "<option value='{$key}'>{$ps}</option>";
    }

    $sOptionUser = "";
    foreach($aUser as $u) {
        $sOptionUser .= "<option value='{$u->getId()}'>{$u->getFullName()}</option>";
    }
?>

<div class="row">
	<h1 class="col-md-9">Quảng cáo <small>Quản lý các quảng cáo</small></h1>
    <h1 class="col-md-3">
        <a class="btn btn-success pull-right" href="<?php echo admin_page_url(ADVERTISE_SLUG.'/them-moi'); ?>">
            <i class="glyphicon glyphicon-plus-sign"></i> Thêm quảng cáo
        </a>
    </h1>
    <div class="col-md-12">
		<ol class="breadcrumb">
            <li><a href="<?php echo admin_page_url(); ?>"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li class="active"><i class="fa fa-table"></i> Danh sách các quảng cáo hiện có</li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <!-- Nav tabs -->
        <ul class="nav nav-tabs" role="tablist">
            <li class="active">
                <a href="#ad-active" role="tab" data-toggle="tab">Đang hoạt động
                    <span class="badge badge-error"><?php echo count($aAdvertise); ?></span>
                </a>
            </li>
            <li>
                <a href="#ad-register" role="tab" data-toggle="tab">Đang đăng kí
                    <span class="badge badge-error"><?php echo count($aAdvertiseRegister); ?></span>
                </a>
            </li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content mgt10">
            <div class="tab-pane active" id="ad-active">
                <?php
                    $this->load->view('backend/admin/advertise/active.html.php',
                        array(
                            'aPosition' => $aPosition,
                            'sOptionPosition' => $sOptionPosition,
                            'sOptionUser' => $sOptionUser
                        )
                    );
                ?>
            </div>
            <div class="tab-pane" id="ad-register">
                <?php
                    $this->load->view('backend/admin/advertise/register.html.php',
                        array(
                            'aPosition' => $aPosition,
                            'sOptionPosition' => $sOptionPosition,
                            'sOptionUser' => $sOptionUser
                        )
                    );
                ?>
            </div>
        </div>
    </div>
</div>